![]() |
ICS_Class 3.0.0
|
近藤科学のKRSサーボをArduinoのHardwareSerialからアクセスできるようにしたクラス [詳解]
#include <IcsHardSerialClass.h>
公開メンバ関数 | |
| IcsHardSerialClass () | |
| コンストラクタ | |
| IcsHardSerialClass (HardwareSerial *icsSerial, byte enpin) | |
| コンストラクタ | |
| IcsHardSerialClass (HardwareSerial *icsSerial, byte enpin, long baudrate, int timeout) | |
| コンストラクタ | |
| ~IcsHardSerialClass () | |
| デストラクタ | |
| bool | begin () |
| 通信の初期設定 | |
| bool | begin (long baudrate, int timeout) |
| 通信の初期設定 | |
| bool | begin (HardwareSerial *serial, int enpin, long baudrate, int timeout) |
| 通信の初期設定 | |
| virtual bool | synchronize (byte *txBuf, byte txLen, byte *rxBuf, byte rxLen) |
| ICS通信の送受信 | |
基底クラス IcsBaseClass に属する継承公開メンバ関数 | |
| int | setPos (byte id, unsigned int pos) |
| サーボモータの角度を変更します | |
| int | setFree (byte id) |
| サーボモータをフリー(脱力)状態にします | |
| int | setStrc (byte id, unsigned int strc) |
| サーボモータのストレッチ(保持力)の値を書き込みます | |
| int | setSpd (byte id, unsigned int spd) |
| サーボモータのスピード(出力)を変更します | |
| int | setCur (byte id, unsigned int curlim) |
| サーボモータの電流リミット(電流制限)値を変更します | |
| int | setTmp (byte id, unsigned int tmplim) |
| サーボモータの温度リミット(温度制限)値を変更します | |
| int | getStrc (byte id) |
| サーボモータのストレッチ(保持力)の値を読み込みます | |
| int | getSpd (byte id) |
| サーボモータのスピード(出力)を読み込みます | |
| int | getCur (byte id) |
| サーボモータの現在の電流値を読み込みます | |
| int | getTmp (byte id) |
| サーボモータの現在の温度値を読み込みます | |
| int | getPos (byte id) |
| サーボモータの現在のポジションデータを読み込みます | |
| int | getID () |
| ICSデバイスのIDを取得する | |
| int | setID (byte id) |
| ICSデバイスのIDを書き込む | |
| unsigned short | getKrrButton () |
| KRRが受信しているボタンのデータを取得します | |
| int | getKrrAnalog (int paCh) |
| KRRが受信している指定したアナログポート(PA)のデータを取得します | |
| bool | getKrrAllData (unsigned short *button, int adData[4]) |
| KRRが受信しているボタンデータおよびアナログポート(PA)のデータをすべて取得します | |
限定公開メンバ関数 | |
| void | enHigh () |
| enPinに割り当てられているピンをHにする | |
| void | enLow () |
| enPinに割り当てられているピンをLにする | |
基底クラス IcsBaseClass に属する継承限定公開メンバ関数 | |
| byte | idMax (byte id) |
| サーボIDが範囲内か見る | |
| bool | maxMin (int maxPos, int minPos, int val) |
| ポジションデータの最大、最小値の範囲に収める | |
限定公開変数類 | |
| HardwareSerial * | icsHardSerial |
| arudinoのシリアル型のポインタを格納 | |
| int | enPin |
| イネーブルピン(送受信を切り替える)のピン番号を格納しておく変数 | |
| long | baudRate |
| ICSの通信速度を格納しておく変数 | |
| int | timeOut |
| 通信のタイムアウト(ms)を格納しておく変数 | |
その他の継承メンバ | |
基底クラス IcsBaseClass に属する継承静的公開メンバ関数 | |
| static int | degPos (float deg) |
| 角度データ(float型)をポジションデータに変換 | |
| static float | posDeg (int pos) |
| ポジションデータを角度データ(float型)に変換 | |
| static int | degPos100 (int deg) |
| 角度データx100(int型)をポジションデータに変換 | |
| static int | posDeg100 (int pos) |
| ポジションデータを角度データ(int型)に変換 | |
基底クラス IcsBaseClass に属する継承静的公開変数類 | |
| static constexpr int | MAX_ID = 31 |
| サーボIDの最大値 | |
| static constexpr int | MIN_ID = 0 |
| サーボIDの最小値 | |
| static constexpr int | MAX_POS = 11500 |
| サーボのポジション最大値 | |
| static constexpr int | MIN_POS = 3500 |
| サーボのポジション最小値 | |
| static constexpr int | ICS_FALSE = -1 |
| ICS通信等々で失敗したときの値 | |
基底クラス IcsBaseClass に属する継承静的限定公開変数類 | |
| static constexpr float | ANGLE_F_FALSE = 9999.9 |
| 角度計算時、範囲内に入ってない場合は999.9にする(負側の場合はマイナスをつける) | |
| static constexpr int | ANGLE_I_FALSE = 0x7FFF |
| 角度計算時、範囲内に入ってない場合は0x7FFFにする(負側の場合はマイナスをつける) | |
| static constexpr int | MAX_127 = 127 |
| パラメータの最大値 | |
| static constexpr int | MAX_63 = 63 |
| パラメータの最大値(電流値) | |
| static constexpr int | MIN_1 = 1 |
| パラメータの最小値 | |
| static constexpr float | MAX_DEG = 180.0 |
| 角度の最大値 | |
| static constexpr float | MIN_DEG = -180.0 |
| 角度の最大値 | |
| static constexpr int | MAX_100DEG = 18000 |
| 角度(x100)の最大値 | |
| static constexpr int | MIN_100DEG = -18000 |
| 角度(x100)の最小値 | |
近藤科学のKRSサーボをArduinoのHardwareSerialからアクセスできるようにしたクラス
IcsBaseClassからの派生して作られている
| IcsHardSerialClass::IcsHardSerialClass | ( | HardwareSerial * | icsSerial, |
| byte | enpin ) |
コンストラクタ
| [in] | *icsSerial | ICSに設定するUART(HardwareSerial型のポインタ) |
| [in] | enpin | 送受信切替えピンのピン番号 |
| IcsHardSerialClass::IcsHardSerialClass | ( | HardwareSerial * | hardSerial, |
| byte | enpin, | ||
| long | baudrate, | ||
| int | timeout ) |
コンストラクタ
| [in] | *hardSerial | ICSに設定するUART(HardwareSerial型のポインタ) |
| [in] | enpin | 送受信切替えピンのピン番号 |
| [in] | baudrate | サーボの通信速度 |
| [in] | timeout | 受信タイムアウト(ms) |
| IcsHardSerialClass::~IcsHardSerialClass | ( | ) |
デストラクタ
| bool IcsHardSerialClass::begin | ( | ) |
通信の初期設定
| true | 通信設定完了 |
| false | 通信設定失敗 |
| bool IcsHardSerialClass::begin | ( | HardwareSerial * | serial, |
| int | enpin, | ||
| long | baudrate, | ||
| int | timeout ) |
通信の初期設定
| [in] | *serial | ICSに設定するUART(HardwareSerial型のポインタ) |
| [in] | enpin | 送受信切替えピンのピン番号 |
| [in] | baudrate | ICSの通信速度(115200,625000,1250000(1.25M)bps) |
| [in] | timeout | 受信タイムアウト(ms) |
| true | 通信設定完了 |
| false | 通信設定失敗 |
| bool IcsHardSerialClass::begin | ( | long | baudrate, |
| int | timeout ) |
通信の初期設定
| [in] | baudrate | ICSの通信速度(115200,625000,1250000(1.25M)bps) |
| [in] | timeout | 受信タイムアウト(ms) |
| true | 通信設定完了 |
| false | 通信設定失敗 |
|
virtual |
ICS通信の送受信
| [in,out] | *txBuf | |
| [in] | txLen | |
| [out] | *rxBuf | 受信格納バッファ |
| [in] | rxLen | 受信データ数 |
| true | 通信成功 |
| false | 通信失敗 |
IcsBaseClassを再実装しています。